#cs ----------------------------------------------------------------------------
	
	$Author: bjoern.kaiser $
	$LastChangedDate: 2008-05-07 12:57:19 +0000 (Wed, 07 May 2008) $
	
	Script Function:
	Injection of HDC drivers per peimg.exe
	
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here


Func _HdcInject($arrDrivers, $strWindowsPath)
	Local $intReturn
	Local $strCmd
	Local $strPeImg = $gStrSourceDrv & "\bin\peimg.exe"
	Local $binCreatedPfiles
	Local $binCreatedUsers
	
	If IsArray($arrDrivers) Then
		If Not FileExists("C:\users") Then
			DirCreate("C:\users")
			$binCreatedUsers = 1
		EndIf
		
		If Not FileExists("C:\program files") Then
			DirCreate("C:\program files")
			$binCreatedPfiles = 1
		EndIf
		
		For $item In $arrDrivers
			If $item Then
				$strCmd = $strPeImg & " /inf=" & $item & " " & $strWindowsPath
				If Not $gBinTest Then
					_log("I", $strCmd)
					$intReturn = RunWait($strCmd, @SystemDir, @SW_HIDE)
					_log("D", "PEIMG returned: " & $intReturn)
					$intReturn = RunWait($strCmd, @SystemDir, @SW_HIDE)
					_log("D", "PEIMG returned: " & $intReturn)
				Else
					_log("I", $strCmd)
				EndIf
			EndIf
		Next
		If $binCreatedPfiles = 1 Then DirRemove("C:\program files", 1)
		If $binCreatedUsers = 1 Then DirRemove("C:\users", 1)
	Else
		SetError(1)
		Return (0)
	EndIf
	Return 1
EndFunc   ;==>_HdcInject